Next | Prev | Up | Top | Contents | Index

User Command Summary

The commands described in this section allow users on workstations and across the network to access the printing facilities. Users should use the lp and cancel commands most frequently, the lpstat command occasionally, and the enable and disable commands infrequently, if ever. No special privileges are necessary to use these commands.

This section describes the five basic lp commands.

lp

Routes jobs to a destination and places them in a queue. The destination may be either a single printer or a class of printers.

cancel

Cancels spooled print requests.

disable

Prevents a printer from printing jobs that are in the queue.

enable

Allows a printer to print jobs in the queue.

lpstat

Reports the status of the lp spooling system.

lp: Send a Print Job to a Printer

The lp command routes a print job request to a destination where it is placed in a queue to await printing. The destination may be a single printer or a class of printers. If you do not specify a destination, the request is routed to the default destination. For information on how to set the default printer destination, see "Changing the Default Printer Destination".

The form of the lp command is:

lp [options] filename...

Every time an lp request is made, a request ID is assigned to the job, and a record of the request is sent to you. The request ID has this form:

destination-seqnum

destination is the printer or class of printers to which the job has been routed. seqnum is an arbitrary sequence number assigned to the job by the lp system.

lp has three options that are particularly useful: -n, -d, and -c.

You can combine these command options in any order. For a complete list of lp options, see the lp(1) reference page. Example 2-1 and Example 2-2 show some uses of the lp command.

Example 2-1 : Simple lp Print Requests

lp myfile

lp < myfile

cat myfile | lp

To request a printout, you can use the lp command several different ways. The entries in Example 2-1 perform identical functions, sending a simple print request to the default printer.

Example 2-2 : Complex lp Print Request

lp -n3 -dfoo -c myfile

The entry in Example 2-2 prints three copies on printer foo and creates a copy of the file for the printer to process, ensuring that if changes are made to the file after the print request, the original file is printed.


cancel: Remove a Print Request

The cancel command removes a job from the queue. You can cancel a job either before or after it starts printing, but you can cancel only one job at a time.

Any user can cancel any other user's job. If you cancel another user's print request, mail is sent to that user. Once you cancel a job, you can request that it be printed again only with the lp command:

cancel printer-name

cancel request-ID

Using the printer-name cancels the job currently being printed. Using the request-ID cancels the specified job whether or not it is currently being printed, as shown in Example 2-3.

Example 2-3 : Using the cancel Command

cancel myprinter request "myprinter-16" cancelled

cancel myprinter-17 request "myprinter-17" cancelled

Issuing a cancel command does not work when the job is being printed on a remote printer. To cancel a print job on a remote printer, log in to the remote system and issue the cancel command.


disable: Stop Printer From Processing Requests

The disable command prevents the printer from printing jobs in the queue. Possible reasons for disabling the printer include malfunctioning hardware, paper jams, running out of paper, or end-of-day shutdowns. If a printer is busy at the time it is disabled, the request it was printing is reprinted in its entirety when you reenable the printer.

You can send job requests to a printer that has been disabled. The jobs are put in the queue but are not printed until the printer is enabled.

To disable a printer, type:

disable [-c] [-r"reason"] printer(s)


enable: Allow Printer to Process Requests

The enable command permits a printer that has been disabled to begin printing jobs from the queue. Example 2-4 shows how to use the enable command. To enable a printer, type:

enable printer...

Example 2-4 : Using the enable Command

disable -r"paper jam" myprinter printer "myprinter" now disabled

enable myprinter printer "myprinter" now enabled


lpstat: Report lp Status

The lpstat command reports the status of various aspects of the lp system. To check lp status, type:

lpstat [options]

Use the -t option to display a complete report on the status of the lp system.

For a complete list of options, see the lpstat(1) reference page.

Example 2-5 shows an example lpstat -t command and its result:

Example 2-5 : Using the lpstat Command

lpstat -t scheduler is running system default destination: myprinter members of class foo: myprinter device for myprinter: /dev/plp myprinter accepting requests since Jul 31 21:40 foo accepting requests since Jul 30 12:23 printer myprinter now printing foo-18 enabled since Aug 5 15:34 foo-18 mylogin 3156 Aug 7 17:11 on myprinter


Next | Prev | Up | Top | Contents | Index